package dailearn.feign.controller;

import dailearn.feign.producer.ClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 *
 * @author daify
 * @date 2019-07-09 10:29
 **/
@RestController
public class FeignUploadController {

    @Autowired
    private ClientService clientService;

    @RequestMapping(value = "/upload", method = RequestMethod.POST,consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public String handleFileUpload(@RequestPart(value = "file") MultipartFile file)
            throws IOException {
        return clientService.handleFileUpload(file);
    }
}
